home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mintmant / fselect.txt < prev    next >
Text File  |  1992-03-24  |  3KB  |  130 lines

  1. Fselect(2)                Oct. 1, 1991                 Fselect(2)
  2.  
  3.  
  4.  
  5. NAME
  6.      Fselect - select file descriptors that are ready for reading
  7.      or writing
  8.  
  9. SYNOPSIS
  10.      WORD Fselect(WORD timeout, LONG *rfds, LONG *wfds, ((long)0));
  11.  
  12. DESCRIPTION
  13.      Fselect checks two sets of open file descriptors and  deter-
  14.      mines  which have data ready to read, and/or which are ready
  15.      to be written to. If none are ready yet, the process goes to
  16.      sleep  until  some  member  of the sets are ready or until a
  17.      specified amount of time has elapsed.
  18.  
  19.      rfds points to a long word which represents a set of  GEMDOS
  20.      file  descriptors;  bit  n  of this long word is set if file
  21.      descriptor n is to be checked for input data. An  empty  set
  22.      may optionally be represented by a NULL pointer instead of a
  23.      pointer to 0. Similarly, wfds points to a 32 bit  long  word
  24.      which indicates which file descriptors are to be checked for
  25.      output status. When Fselect returns, the old values  pointed
  26.      to  by  rfds  and  wfds (if non-NULL) are overwritten by new
  27.      long words indicating which file  descriptors  are  actually
  28.      ready for reading or writing; these will always form subsets
  29.      of the file descriptors originally  specified  as  being  of
  30.      interest.
  31.  
  32.      timeout is a 16 bit unsigned integer  specifying  a  maximum
  33.      number  of  milliseconds  to  wait before returning; if this
  34.      number is 0, no maximum is set and the call will block until
  35.      one  of  the file descriptors specified is ready for reading
  36.      or writing, as appropriate. Thus,  Fselect(0,0L,0L,0L)  will
  37.      block  forever, whereas Fselect(1,0L,0L,0L) will pause for 1
  38.      millisecond.
  39.  
  40.      The final argument, a long word, must always  be  0  (it  is
  41.      reserved for future enhancements).
  42.  
  43. RETURNS
  44.      The sum of the numbers of bits set in the long words pointed
  45.      to  by rfds and wfds.  This will be 0 if the timeout expires
  46.      without any of the specified file descriptors becoming ready
  47.      for  reading  or writing, as appropriate, and nonzero other-
  48.      wise.
  49.  
  50.      EIHNDL if any handle specified by the long words pointed  to
  51.      by rfds or wfds is not a valid (open) GEMDOS handle.
  52.  
  53. SEE ALSO
  54.      Finstat(2), Foutstat(2)
  55.  
  56.  
  57.  
  58.  
  59.  
  60. Version 0.9   Last change: MiNT Programmer's Manual             1
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. Fselect(2)                Oct. 1, 1991                 Fselect(2)
  68.  
  69.  
  70.  
  71. BUGS
  72.      The system timer is not actually  accurate  to  the  nearest
  73.      millisecond,  so  the  timeout  could last for up to 19 mil-
  74.      liseconds longer than specified.
  75.  
  76.      Fselect does not work correctly on any  BIOS  device  except
  77.      the keyboard.
  78.  
  79.      Note that if an error condition occurs on one  of  the  file
  80.      descriptors  (for example, if the read status of a pipe with
  81.      no more writers is being requested) then Fselect  will  mark
  82.      that file descriptor as being ready for reading (or writing,
  83.      as appropriate). This is not strictly speaking a bug,  since
  84.      a  subsequent  read  will not block (it will return an error
  85.      condition), but programmers should be aware of the possibil-
  86.      ity.
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126. Version 0.9   Last change: MiNT Programmer's Manual             2
  127.  
  128.  
  129.  
  130.